const {
    default: Vue
} = require("vue");
import axios from 'axios'
// import qs  from 'qs'
const headers = {
    // 'Content-Type':'application/x-www-form-urlencoded'
}

export const showStuAll = async () => {
    let response = await axios({
        method: "get",
        url: "/api/stus",
    })
    return response;
}

export const findStuById = async (id) => {
    let response = await axios({
        method: "get",
        url: "/api" + "/" + id,


    })
    return response;
}

export const delStu = async (id) => {
    let response = await axios({
        method: "delete",
        url: "/api" + "/stus/" + id
    })
    return response;
}

export const updateStu = async (data) => {
    let response = await axios({
        headers,
        method: "PUT",
        url: "/api/updateStu",
        data: data,

    })
    return response.data;

}

export const saveStu = async (name) => {
    let response = await axios({
        headers,
        method: "post",
        url: "/api/stus",
        data: {
            name
        },

    })
    return response.data;

}